import { openAIAPI } from './api';

// 测试OpenAI API是否正常工作
export const testOpenAIAPI = async () => {
  try {
    console.log('开始测试OpenAI API...');
    
    // 测试汽车评分
    const testVehicleData = {
      brand: '比亚迪',
      model: '秦PLUS DM-i',
      year: 2022,
      mileage: 15000,
      condition: '良好',
      price: 12.5,
      description: '新能源混动车型，车况良好',
      images: ['image1.jpg', 'image2.jpg']
    };

    console.log('测试车辆数据:', testVehicleData);
    
    const result = await openAIAPI.scoreVehicle(testVehicleData);
    console.log('OpenAI API测试成功！');
    console.log('返回结果:', result);
    
    return result;
  } catch (error) {
    console.error('OpenAI API测试失败:', error);
    throw error;
  }
};

// 测试价格评估
export const testPriceEvaluation = async () => {
  try {
    console.log('开始测试价格评估...');
    
    const testData = {
      brand: '特斯拉',
      model: 'Model 3',
      year: 2021,
      mileage: 25000,
      condition: '优秀',
      marketPrice: 250000
    };

    console.log('测试数据:', testData);
    
    const result = await openAIAPI.evaluatePrice(testData);
    console.log('价格评估测试成功！');
    console.log('返回结果:', result);
    
    return result;
  } catch (error) {
    console.error('价格评估测试失败:', error);
    throw error;
  }
}; 